const redis = require("redis");
const { REDIS_CONF } = require("../conf/db.js");

// 创建客户端
const redisClient = redis.createClient({
  url: `redis://${REDIS_CONF.host}:${REDIS_CONF.port}`, // 连接地址
  legacyMode: true, // 兼容模式
});

// 连接
redisClient
  .connect()
  .then(() => console.log("redis connect success!"))
  .catch(console.error);

module.exports = redisClient;
